package org.apache.solr.search.grouping;

import org.apache.lucene.search.Sort;
import org.apache.solr.search.Grouping;

/**
 * Encapsulates the grouping options like fields group sort and more specified by clients.
 *
 * @lucene.experimental
 */
public class GroupingSpecification {

    private String[] fields = new String[]{};
    private String[] queries = new String[]{};
    private String[] functions = new String[]{};
    private int offset;
    private int limit;
    private int groupOffset;
    private int groupLimit;
    private Sort groupSort;
    private Sort sortWithinGroup;
    private boolean includeGroupCount;
    private boolean main;
    private Grouping.Format responseFormat;
    private boolean needScore;
    private boolean truncateGroups;

    public String[] getFields() {
        return fields;
    }

    public void setFields(String[] fields) {
        if (fields == null) {
            return;
        }
        this.fields = fields;
    }

    public String[] getQueries() {
        return queries;
    }

    public void setQueries(String[] queries) {
        if (queries == null) {
            return;
        }
        this.queries = queries;
    }

    public String[] getFunctions() {
        return functions;
    }

    public void setFunctions(String[] functions) {
        if (functions == null) {
            return;
        }

        this.functions = functions;
    }

    public int getGroupOffset() {
        return groupOffset;
    }

    public void setGroupOffset(int groupOffset) {
        this.groupOffset = groupOffset;
    }

    public int getGroupLimit() {
        return groupLimit;
    }

    public void setGroupLimit(int groupLimit) {
        this.groupLimit = groupLimit;
    }

    public int getOffset() {
        return offset;
    }

    public void setOffset(int offset) {
        this.offset = offset;
    }

    public int getLimit() {
        return limit;
    }

    public void setLimit(int limit) {
        this.limit = limit;
    }

    public Sort getGroupSort() {
        return groupSort;
    }

    public void setGroupSort(Sort groupSort) {
        this.groupSort = groupSort;
    }

    public Sort getSortWithinGroup() {
        return sortWithinGroup;
    }

    public void setSortWithinGroup(Sort sortWithinGroup) {
        this.sortWithinGroup = sortWithinGroup;
    }

    public boolean isIncludeGroupCount() {
        return includeGroupCount;
    }

    public void setIncludeGroupCount(boolean includeGroupCount) {
        this.includeGroupCount = includeGroupCount;
    }

    public boolean isMain() {
        return main;
    }

    public void setMain(boolean main) {
        this.main = main;
    }

    public Grouping.Format getResponseFormat() {
        return responseFormat;
    }

    public void setResponseFormat(Grouping.Format responseFormat) {
        this.responseFormat = responseFormat;
    }

    public boolean isNeedScore() {
        return needScore;
    }

    public void setNeedScore(boolean needScore) {
        this.needScore = needScore;
    }

    public boolean isTruncateGroups() {
        return truncateGroups;
    }

    public void setTruncateGroups(boolean truncateGroups) {
        this.truncateGroups = truncateGroups;
    }
}
